use tauri::Runtime;

use tauri_plugin_log::{Target, TargetKind};

pub trait KoiTauriPlugin {
    fn init_plugin(self) -> Self;
}

impl<R: Runtime> KoiTauriPlugin for tauri::Builder<R> {
    // 初始化插件
    fn init_plugin(self) -> Self {
        self.plugin(tauri_plugin_opener::init())
            .plugin(
                tauri_plugin_log::Builder::new()
                    .targets([
                        Target::new(TargetKind::Stdout),
                        Target::new(TargetKind::LogDir { file_name: None }),
                        Target::new(TargetKind::Webview),
                    ])
                    .build(),
            )
            .plugin(tauri_plugin_notification::init())
            .plugin(tauri_plugin_http::init())
            .plugin(tauri_plugin_clipboard_manager::init())
    }
}
